package vip.xiaonuo.facedoor.rule;

import com.deliveredtechnologies.rulebook.FactMap;
import com.deliveredtechnologies.rulebook.NameValueReferableMap;
import com.deliveredtechnologies.rulebook.model.runner.RuleBookRunner;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
@SuppressWarnings("all")
public class RuleRunner implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
//        hq(); // 海清
        dw(); // 德沃
        //ks(); // 旷世
        //vein();// 掌静脉
//        ht();// 宏图


    }

    private static void dw() {
        RuleBookRunner dw = new RuleBookRunner("vip.xiaonuo.facedoor.rule");
        NameValueReferableMap dwMap = new FactMap();
        dwMap.setValue("manufacturer", ManufacturerEnums.DW);
        dw.run(dwMap);
    }

    private static void ht() {
        RuleBookRunner dw = new RuleBookRunner("vip.xiaonuo.facedoor.rule");
        NameValueReferableMap dwMap = new FactMap();
        dwMap.setValue("manufacturer", ManufacturerEnums.HT);
        dw.run(dwMap);
    }

    private static void vein() {
        RuleBookRunner dw = new RuleBookRunner("vip.xiaonuo.facedoor.rule");
        NameValueReferableMap dwMap = new FactMap();
        dwMap.setValue("manufacturer", ManufacturerEnums.VEIN);
        dw.run(dwMap);
    }

    private static void hq() {
        RuleBookRunner ruleRunner = new RuleBookRunner("vip.xiaonuo.facedoor.rule");
        NameValueReferableMap hqMap = new FactMap();
        hqMap.setValue("manufacturer", ManufacturerEnums.HAI_QING);
        ruleRunner.run(hqMap);
    }

    private static void ks() {
        RuleBookRunner ruleRunner = new RuleBookRunner("vip.xiaonuo.facedoor.rule");
        NameValueReferableMap hqMap = new FactMap();
        hqMap.setValue("manufacturer", ManufacturerEnums.KS);
        ruleRunner.run(hqMap);
    }
}
